'use strict';
const path = require('path');
const webpack = require('webpack');
const webpackBase = require('./webpack.base');
const merge = require('webpack-merge');
const webpackDll = require('./webpack.dll');

// 开发配置
module.exports = merge(webpackBase, webpackDll, {
    mode: "development",
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.DefinePlugin({
            'process.env': {
                'NODE_ENV': JSON.stringify('development'),
            }
        }),

    ],
    devServer: {
        inline: true, //打包后加入一个websocket客户端
        hot: true, //热加载
        
        contentBase: path.join(__dirname, "..", "dist"), //静态文件根目录
        port: 9000, // 端口
        host: '0.0.0.0',
        open: true, //自动打开浏览器
        overlay: false, //在浏览器展示错误
        compress: true // 服务器返回浏览器的时候是否启动gzip压缩
    },
    watchOptions: {
        ignored: /node_modules/, //忽略不用监听变更的目录
        aggregateTimeout: 1000, //防止重复保存频繁重新编译,500毫米内重复保存不打包
        poll: 1000 //每秒询问的文件变更的次数
    },

});